use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};

#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
#[sea_orm(table_name = "cms_article")]
pub struct Model {
    #[sea_orm(primary_key)]
    pub id: i32,
    /// 所属专题
    pub topic_id: i32,
    /// 文章标题
    pub title: String,
    /// 作者
    pub author: String,
    /// 转载来源网址
    pub fromurl: String,
    /// 封面图
    pub image: String,
    /// 关键词
    pub keywords: String,
    /// 简介
    pub description: String,
    /// 是否允许评论
    pub allow_comments: bool,
    /// 状态(-1:不通过,0未审核,1:通过)
    pub status: i8,
    /// 发布人id
    pub user_id: i32,
    /// 阅读数量
    pub read_number: u32,
    /// 内容
    #[sea_orm(column_type = "custom(\"LONGTEXT\")")]
    pub content: String,
    pub created_at: chrono::NaiveDateTime,
    pub updated_at: chrono::NaiveDateTime,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {}

impl ActiveModelBehavior for ActiveModel {}
